package com.lzh.eventdemo.service;

import com.lzh.eventdemo.event.UserRegisterEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Service;

/**
 * @Description: 1 通过@EventListener 监听事件
 * @Author: LiuZiHao
 * @Date: 2022/8/30 10:49
 */
@Service
public class CouponService {
    private final Logger logger = LoggerFactory.getLogger(getClass());

    @EventListener
    public void addCoupon(UserRegisterEvent event) {
        logger.info("[addCoupon][给用户({}) 发放优惠劵]", event.getUsername());
    }
}
